index2position Subroutine

public subroutine index2position(index_, nx, ny, nz, cx, cy, cz)

Subroutine to calculate the position ix,iy,iz inside a rectangular grid from index

Type Bound

self_organizing_map

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: index_

Integer variable representing the index

integer, intent(in) :: nx

Integer variables representing the dimensions of the kohonen map

integer, intent(in) :: ny

Integer variables representing the dimensions of the kohonen map

integer, intent(in) :: nz

Integer variables representing the dimensions of the kohonen map

integer, intent(inout) :: cx

Integer variables representing the position of the node

integer, intent(inout) :: cy

Integer variables representing the position of the node

integer, intent(inout) :: cz

Integer variables representing the position of the node


Called by

proc~~index2position~~CalledByGraph proc~index2position self_organizing_map%index2position proc~update_weights self_organizing_map%update_weights proc~update_weights->proc~index2position proc~train_som_data self_organizing_map%train_som_data proc~train_som_data->proc~update_weights proc~external_train_map self_organizing_map%external_train_map proc~external_train_map->proc~train_som_data proc~train_som train_som proc~train_som->proc~train_som_data

Source Code

    subroutine index2position(index_,nx,ny,nz,cx,cy,cz)
!========================================================================================
!! Subroutine to calculate the position ix,iy,iz inside a rectangular grid from index
        integer,intent(in) :: index_
!! Integer variable representing the index
        integer,intent(in) :: nx,ny,nz
!! Integer variables representing the dimensions of the kohonen map
        integer,intent(inout) :: cx,cy,cz
!! Integer variables representing the position of the node
!  write(*,*) index_,nx,ny,1+int((index_-1)/(nx*ny))
        cz=min(1+int((index_-1)/(nx*ny)),nz);
        cy=min(1+int((index_-1-(cz-1)*nx*ny)/nx),ny);
        cx=min(index_-(cz-1)*nx*ny-(cy-1)*nx,nx);
!
    end subroutine index2position